<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Connecting to Firebird databases</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="ref.pdo-firebird.html">« Firebird (PDO)</a></li>
      <li style="float: right;"><a href="ref.pdo-ibm.html">IBM (PDO) »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.pdo-firebird.html">Firebird (PDO)</a></li>
    <li>Connecting to Firebird databases</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="ref.pdo-firebird.connection" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">PDO_FIREBIRD DSN</h1>
    <p class="verinfo">(PECL PDO_FIREBIRD &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">PDO_FIREBIRD DSN</span> &mdash; <span class="dc-title">Connecting to Firebird databases</span></p>

   </div>

   <div class="refsect1 description" id="refsect1-ref.pdo-firebird.connection-description">
    <h3 class="title">说明</h3>
    <p class="para">
     The PDO_FIREBIRD Data Source Name (DSN) is composed of the following elements:
     <dl>
      
       <dt>
DSN prefix</dt>

       <dd>

        <p class="para">
        The DSN prefix is <strong class="userinput"><code>firebird:</code></strong>.
        </p>
       </dd>

      
      
       <dt>
<code class="literal">dbname</code></dt>

       <dd>

        <p class="para">
         The name of the database.
        </p>
       </dd>

      
      
       <dt>
<code class="literal">charset</code></dt>

       <dd>

        <p class="para">
         The character set.
        </p>
       </dd>

      
      
       <dt>
<code class="literal">role</code></dt>

       <dd>

        <p class="para">
         The SQL role name.
        </p>
       </dd>

      
      
       <dt>
<code class="literal">dialect</code></dt>

       <dd>

        <p class="para">
         The dialect of the database; either <code class="literal">1</code> or <code class="literal">3</code>.
         If not specified, the dialect defaults to <code class="literal">3</code>.
         Available as of PHP 7.4.0.
        </p>
       </dd>

      
     </dl>

    </p>
   </div>

   <div class="refsect1 examples" id="refsect1-ref.pdo-firebird.connection-examples">
    <h3 class="title">范例</h3>
    <p class="para">
     <div class="example" id="example-1091">
      <p><strong>示例 #1 PDO_FIREBIRD DSN example with path</strong></p>
      <div class="example-contents"><p>
       The following example shows a PDO_FIREBIRD DSN for connecting to
       Firebird databases:
       <div class="example-contents"><div class="cdata"><pre>
firebird:dbname=/path/to/DATABASE.FDB
</pre></div>
       </div>

      </p></div>
     </div>
     <div class="example" id="example-1092">
      <p><strong>示例 #2 PDO_FIREBIRD DSN example with port and path</strong></p>
      <div class="example-contents"><p>
       The following example shows a PDO_FIREBIRD DSN for connecting to
       a Firebird database using hostname port and path:
       <div class="example-contents"><div class="cdata"><pre>
firebird:dbname=hostname/port:/path/to/DATABASE.FDB
</pre></div>
       </div>

      </p></div>
     </div>
     <div class="example" id="example-1093">
      <p><strong>示例 #3 PDO_FIREBIRD DSN example with localhost and path to employee.fdb on Debian system</strong></p>
      <div class="example-contents"><p>
       The following example shows a PDO_FIREBIRD DSN for connecting to
       a Firebird database employee.fdb using localhost:
       <div class="example-contents"><div class="cdata"><pre>
firebird:dbname=localhost:/var/lib/firebird/2.5/data/employee.fdb
</pre></div>
       </div>

      </p></div>
     </div>
     <div class="example" id="example-1094">
      <p><strong>示例 #4 PDO_FIREBIRD DSN to connect to a dialect 1 database</strong></p>
      <div class="example-contents"><p>
       The following example shows a PDO_FIREBIRD DSN for connecting to
       a Firebird database test.fdb which has been created using dialect 1.
       This is only supported as of PHP 7.4.0.
      </p></div>
      <div class="example-contents">
<div class="cdata"><pre>
firebird:dbname=localhost:/var/lib/firebird/2.5/data/test.fdb;charset=utf-8;dialect=1
</pre></div>
</div>

     </div>
    </p>
   </div>

  </div></div></div></body></html>